home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / src / linux-headers-2.6.28-15 / include / linux / cred.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-12-24  |  1.4 KB  |  51 lines

  1. /* Credentials management
  2.  *
  3.  * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
  4.  * Written by David Howells (dhowells@redhat.com)
  5.  *
  6.  * This program is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU General Public Licence
  8.  * as published by the Free Software Foundation; either version
  9.  * 2 of the Licence, or (at your option) any later version.
  10.  */
  11.  
  12. #ifndef _LINUX_CRED_H
  13. #define _LINUX_CRED_H
  14.  
  15. #define get_current_user()    (get_uid(current->user))
  16.  
  17. #define task_uid(task)        ((task)->uid)
  18. #define task_gid(task)        ((task)->gid)
  19. #define task_euid(task)        ((task)->euid)
  20. #define task_egid(task)        ((task)->egid)
  21.  
  22. #define current_uid()        (current->uid)
  23. #define current_gid()        (current->gid)
  24. #define current_euid()        (current->euid)
  25. #define current_egid()        (current->egid)
  26. #define current_suid()        (current->suid)
  27. #define current_sgid()        (current->sgid)
  28. #define current_fsuid()        (current->fsuid)
  29. #define current_fsgid()        (current->fsgid)
  30. #define current_cap()        (current->cap_effective)
  31.  
  32. #define current_uid_gid(_uid, _gid)        \
  33. do {                        \
  34.     *(_uid) = current->uid;            \
  35.     *(_gid) = current->gid;            \
  36. } while(0)
  37.  
  38. #define current_euid_egid(_uid, _gid)        \
  39. do {                        \
  40.     *(_uid) = current->euid;        \
  41.     *(_gid) = current->egid;        \
  42. } while(0)
  43.  
  44. #define current_fsuid_fsgid(_uid, _gid)        \
  45. do {                        \
  46.     *(_uid) = current->fsuid;        \
  47.     *(_gid) = current->fsgid;        \
  48. } while(0)
  49.  
  50. #endif /* _LINUX_CRED_H */
  51.